Skip to content

London | 26-ITP-SEP | Bartosz Kawiak | Sprint 2 | Course-work-2 - #1542

Open
bartoszkawiak wants to merge 9 commits into
CodeYourFuture:mainfrom
bartoszkawiak:sprint-2
Open

bartoszkawiak wants to merge 9 commits into
CodeYourFuture:mainfrom
bartoszkawiak:sprint-2

Conversation

@bartoszkawiak

Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Task code

CYF-1039

Changelist

Corrected version of : #1532
Completed the Sprint 2 JavaScript exercises, including working with variables, strings, methods, operators, function calls, and basic objects. Added answers and explanations to the exercise questions.

@netlify

netlify Bot commented Sep 19, 2026

Copy link
Copy Markdown

Deploy Preview for cyf-onboarding-module ready!

Name Link
🔨 Latest commit e58f494
🔍 Latest deploy log https://app.netlify.com/projects/cyf-onboarding-module/deploys/6aae4ecdd999d60009ec9474
😎 Deploy Preview https://deploy-preview-1542--cyf-onboarding-module.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
2 paths audited
Performance: 100 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 86 (no change from production)
PWA: -
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@bartoszkawiak bartoszkawiak added 📅 Sprint 2 Assigned during Sprint 2 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Sep 19, 2026

@abdishakoor-dev abdishakoor-dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for redoing the branch. It is clean now.

There are some issues to fix here:

  1. 2-mandatory-errors/: run 0.js, 1.js, 2.js and 4.js with node. Each one stops with an error. Only 3.js gets to the end. See my comment on each file.

  2. 1-key-exercises/2-initials.js prints C, not CKJ.

  3. 1-key-exercises/3-paths.js line 21, see my comment.

  4. 3-mandatory-interpret/2-time-format.js line 1 has been changed from the original, see my comment.

Add the Needs Review label again when you have pushed.

// This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution.

const initials = ``;
const initials = firstName.charAt(0);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run this file. It prints C. Lines 9 and 10 work out the other two characters, but nothing keeps the result, so initials only holds the first one. How can you join all three into one string?

const dir = ;
const ext = ;
const dir = filePath.slice(0, lastSlashIndex);
const ext = filePath.slice(-4);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dir on line 20 is right. For ext, change the file name in filePath to photo.jpeg and run it again. What do you get? Line 13 finds the last / in the path. Could you use the same idea to find the .?

@@ -1,2 +1,5 @@
This is just an instruction for the first activity - but it is just for human consumption

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your answer on line 4 is right. Have you run the file since you wrote it? Lines 1 and 2 are still read as JavaScript, so node stops here. This exercise wants you to change these two lines, not only describe how it would be done.

@@ -2,3 +2,5 @@

const age = 33;
age = age + 1;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have written that let is needed, and that is correct. But line 3 still says const, so the file still stops with an error when you run it. Make the change so the file runs.

@@ -3,3 +3,8 @@

console.log(`I was born in ${cityOfBirth}`);
const cityOfBirth = "Bolton";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good explanation, and the right error. The file still stops when you run it though. What would you move, so that line 4 prints "I was born in Bolton"?

@@ -1,2 +1,4 @@
const 12HourClockTime = "8:53pm";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right about why this happens. Both names are still here though, so node cannot read the file at all. What would you rename them to?

@@ -1,4 +1,4 @@
const movieLength = 8784; // length of movie in seconds
const movieLength = -8784.08; // length of movie in seconds

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was 8784 in the original. It looks like you changed it to try a negative decimal, which is the right thing to try. Put the original value back though, because your answers to c and d describe the original numbers. Then write down in answer f what you saw when you tried the negative value.

@abdishakoor-dev abdishakoor-dev added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Sep 19, 2026
@abdishakoor-dev

Copy link
Copy Markdown
Contributor

Ignore point 4 on my review, about putting movieLength back to 8784. Question f) asks you to try different values, so changing that line is what it wants. Everything else on the list still stands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed Volunteer to add when completing a review with trainee action still to take. 📅 Sprint 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants